const api = require('./api')
const fs = require('fs')
const path = require('path')
const bodyParser=require('body-parser')
const cookieParser = require('cookie-parser')
const session = require('express-session')
const express = require('express')
const app=express()

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:false}))
app.use(cookieParser())
app.use(session(
  {
    secret:'12345',
    name:'session',
    saveUninitialized:true,
    resave:true
  }
))
app.use(api)


app.use(express.static(path.resolve(__dirname,'../dist')))
app.get('*',function(req,res){
    const html=fs.readFileSync(path.resolve(__dirname,'../dist/index.html'),'utf-8')
    res.send(html)
})

app.listen(8088)
console.log('success listen .....')
